home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pas_0493.zip / CHG.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-15  |  1KB  |  45 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 429 of 473
  3. From : Jon Jasiunas                        1:273/216.0          08 Apr 93  22:20
  4. To   : Steve Mckain
  5. Subj : SetFTime
  6. ────────────────────────────────────────────────────────────────────────────────
  7. SM> I'm trying to get the correct procedure down for moving a file using
  8.   >BlockRead/Write and then changing the file date/time on the new file to
  9.   >the old file. I can't seem to figure out how to use GetFTime and
  10.   >SetFTime correctly. Any help would be greatly appreciated. }
  11.  
  12. program Chg;    { no error checking }
  13.  
  14. uses Crt, Dos;
  15.  
  16. var
  17.   F    : File;
  18.   Name : String;
  19.   Time : LongInt;
  20.   DT   : DateTime;
  21.  
  22. begin
  23.   ClrScr;
  24.   Write('File name? ');  ReadLn(Name);
  25.   Assign(F, Name);
  26.   Reset(F);
  27.   GetFTime(F, Time);
  28.   UnPackTime(Time, DT);
  29.   With DT do begin
  30.     WriteLn('File date: ', Month, '/', Day, '/', Year);
  31.     WriteLn('File time: ', Hour, ':', Min, ':', Sec);
  32.   end;
  33.   Writeln;
  34.   With DT do begin
  35.     Write('New Month? ');  ReadLn(Month);
  36.     Write('New Day? ');  ReadLn(Day);
  37.     Write('New Year? ');  ReadLn(Year);
  38.     Write('New Hour? ');  ReadLn(Hour);
  39.     Write('New Minute? ');  ReadLn(Min);
  40.     Write('New Seconds? ');  ReadLn(Sec);
  41.   end;
  42.   PackTime(DT, Time);
  43.   SetFTime(F, Time);
  44.   Close(F);
  45. end.